<?php
include_once '../includes/common.php';
if($islogin2==1){}else sysmsg("您还未登录，请先登录",2,'./login.php',true);
$mod=isset($_GET['mod'])?$_GET['mod']:sysmsg("参数错误",2,'./',true);
$title='用户信息配置';
include_once './header.php';
?>
<div class="row">
    <div class="col-lg-12">
        <div class="card">
            <div class="card-header">
                用户信息配置
            </div>
            <div class="card-body">
                <form class="form-horizontal layui-form">
                    <div class="form-group mb-3">
                        <label for="example-input-normal" style="font-weight: 500">绑定Q Q：</label>
                        <input type="text" name="qq" value="<?php echo $userrow['qq']; ?>" class="form-control" placeholder="用于联系与扫码登录" lay-verType="tips" lay-verify="required"/>
                    </div>
                    <div class="form-group mb-3">
                        <label for="example-input-normal" style="font-weight: 500">绑定邮箱：</label>
                        <input type="text" name="email" value="<?php echo $userrow['email']; ?>" class="form-control" lay-verType="tips" lay-verify="required"/>
                    </div>
                    <div class="form-group mb-3">
                        <label for="example-input-normal" style="font-weight: 500">个性签名：</label>
                        <textarea class="form-control" name="gxqm" rows="5" placeholder="填写个性签名" lay-verType="tips" lay-verify="required"><?php echo $userrow['gxqm']?></textarea>
                    </div>
                    <div class="form-group mb-3">
                        <label for="example-input-normal" style="font-weight: 500">常用登陆地：</label>
                        <textarea class="form-control" name="citylist" rows="5" placeholder="多个登录地用,隔开" lay-verType="tips" lay-verify="required"><?php echo $userrow['citylist']?></textarea>
                    </div>
                    <div class="form-group mb-3">
                        <label for="example-input-normal" style="font-weight: 500">重置密码：</label>
                        <input type="text" name="pwd" value="" class="form-control" placeholder="不修改请留空"/>
                    </div>
                    <button type="submit" class="btn btn-block btn-xs btn-outline-success" lay-submit lay-filter="submit_set">修 改</button>
                </form>
            </div>
        </div>
    </div>
</div>
<?php
include_once './bottom.php';
?>
<script type="text/javascript">

layui.use(['form'], function () {
    var form = layui.form;
    form.on('submit(submit_set)', function (data) {
        layer.alert('是否要执行当前操作？', {
            icon: 3, btn: ['确定', '取消'], btn1: function (layero, index) {
                set();
            }
        });
        return false;
    });
});
function set() {
    var qq = $("input[name='qq']").val();
    var email = $("input[name='email']").val();
    var gxqm = $("textarea[name='gxqm']").val();
    var citylist = $("textarea[name='citylist']").val();
    var pwd = $("input[name='pwd']").val();
    var ii = layer.msg('正在更新信息中,请稍后...', {icon: 16, time: 10 * 1000});
    $.ajax({
        type: "POST",
        url: "ajax.php?act=uset_user",
        data : {qq:qq,email:email,gxqm:gxqm,citylist:citylist,pwd:pwd},
        dataType: "json",
        success: function(data) {
            layer.close(ii);
            if (data.code == 0) {
                layer.msg(data.msg, {
                    icon: 6,
                    end: function (layero, index) {
                        window.location.reload();
                    }
                });
            } else {
                layer.msg(data.msg, {icon: 5});
            }
        },
        error:function(data){
            layer.msg('服务器错误', {icon: 5});
            return false;
        }
    });
    return false;
};
</script>